package com.caration.shell.utils;

import com.caration.shell.workspace2D.ShellAppInfo;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public final class ApplicationUtils {
	public static String getFullName(ShellAppInfo appInfo) {
		return getFullName(appInfo.mComponentName);
	}

	public static String getFullName(ComponentName componentname) {
		return new StringBuilder(componentname.getPackageName()).append("/")
				.append(componentname.getClassName()).toString();
	}

	public static void showAppDetails(Context context, String pkgName) {
		Intent intent = new Intent();
		int version = android.os.Build.VERSION.SDK_INT;
		if (version < 9) {
			String name;
			if (version != 8)
				name = "com.android.settings.ApplicationPkgName";
			else
				name = "pkg";
			intent.setAction(Intent.ACTION_VIEW);
			intent.setClassName("com.android.settings",
					"com.android.settings.InstalledAppDetails");
			intent.putExtra(name, pkgName);
		} else {
			intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
			intent.setData(Uri.fromParts("package", pkgName, null));
		}
		context.startActivity(intent);
	}

}
